<?php
use think\facade\Route;

/** 接口路由 卡券*/
Route::group('coupon', function () {

    Route::get('course$', 		'getCourseCoupon')->middleware(['withoutLogin']); 	// 获取课程可领取卡券
    Route::get('course/user$', 	'getUserCourseCoupon'); // 获取用户已领取卡券 - 针对课程
    Route::get('school$', 		'getSchoolCoupon'); 	// 获取机构可领取卡券
    Route::get('school/user', 	'getUserSchoolCoupon'); // 获取用户已领取卡券 - 针对机构
    Route::post('<id>/derive', 	'deriveCoupon')->pattern(['id' => '\d+']); // 领取卡券
    Route::post('exchange', 	'exchangeCourseCard');  // 兑换课程卡

})->prefix('\app\course\service\coupon\Coupon@');

Route::group('admin/coupon', function () {
    // 发放卡券
    Route::post('grant', 'grant');
})->prefix('\app\course\service\coupon\admin\CouponUser@')->middleware(['adminRoute']);

Route::group('admin/coupon/offline', function () {
    // 发放卡券
    Route::post('grant', 'grant');
})->prefix('\app\course\service\coupon\admin\CouponOffline@')->middleware(['adminRoute']);
